Skip to content

Conversation

@MartinuzziFrancesco
Copy link
Collaborator

@MartinuzziFrancesco MartinuzziFrancesco commented Mar 14, 2025

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Closes #265. I am thinking if the building pieces need to be user facing too. I need to update existing documentation to reflect the new flexibility of the initializers (option of using vector of values for weight). Add docstrings to the building pieces too if they become public api.

@MartinuzziFrancesco MartinuzziFrancesco changed the title generalizing initializers Generalizing initializers Mar 14, 2025
@MartinuzziFrancesco
Copy link
Collaborator Author

I think that we can generalize the minimal reservoir inits even more now by also having some random sign changes there. For this we need to format irrational and bernoulli to simply modify the arrays/matrices in place. Something like

function bernoulli!(rng::AbstractRNG, vecormat::AbstractVecOrMat; p::Number=0.5)
    for idx in eachindex(vecormat)
        if rand(rng) > p # keeping current approach consistent 
            vecormat[idx] = - vecormat[idx]
        end
    end
end

and then having the option to change signs in the inits functions like so

function delay_line!(rng::AbstractRNG, reservoir_matrix::AbstractMatrix, weight::AbstractVector,
        shift::Int; sampling_type=:default, kwargs...) # :bernoulli, :irrational
    for idx in first(axes(reservoir_matrix, 1)):(last(axes(reservoir_matrix, 1)) - shift)
        reservoir_matrix[idx + shift, idx] = weight[idx]
    end
    f_sample = getfield(@__MODULE__, sampling_type)
    f_sample!(rng, reservoir_matrix; kwargs...)
end

@MartinuzziFrancesco MartinuzziFrancesco changed the title Generalizing initializers Generalizing minimal initializers Mar 15, 2025
@MartinuzziFrancesco
Copy link
Collaborator Author

Not really sure why docs are failing, locally they compile just fine. @ChrisRackauckas I can't access the buildkite log it seems, is there any way to get access?

@ChrisRackauckas
Copy link
Member

Pipeline is public now.

@MartinuzziFrancesco
Copy link
Collaborator Author

Awesome, thanks

@MartinuzziFrancesco
Copy link
Collaborator Author

I'm getting

SystemError: futimes: Disk quota exceeded

and it doesn't allow me to relaunch the workflow

@MartinuzziFrancesco
Copy link
Collaborator Author

all seems to be fine now

@MartinuzziFrancesco MartinuzziFrancesco merged commit 6c0e58b into master Mar 18, 2025
15 checks passed
@MartinuzziFrancesco MartinuzziFrancesco deleted the fm/gmi branch March 18, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce code reuse in inits

3 participants